import {
  PhysicalItemRecommendationShape,
  EventRecommendationShape,
  TabSectionData,
  AddressShape,
} from "@/data/shared/entityShapes";
import { detailsType } from "../shared/details";
import { ImageStringFormat, VideoStringFormat } from "../shared/mediaTypes";
import { DateShape, TimeShape } from "../shared/timeTypes";

export const enum ApiSchedulingStatus {
  Ended = 0,
  InProgress = 1,
  NotStarted = 2,
}

export type ExhibitionSchedulingShape = {
  date: DateShape;
  timeSlots: {
    // schedulingId: number;
    sechdulingId: number; // Temp misspelled API
    timeStart: TimeShape;
    timeEnd: TimeShape;
    remainingSeatCount: number;
    schedulingStatus: ApiSchedulingStatus;
    isAppointment: boolean;
    price: number;
  }[];
};

export type ExhibitionListingShape = {
  appointmentStatus: number;
  heroExhibitionId: number;
  heroExhibitionName: string;
  heroExhibitionCover: string;
  heroExhibitionDateStart: DateShape;
  heroExhibitionDateEnd: DateShape;
  listedExhibitions: {
    id: number;
    cover: string;
    sharePoster: string;
    name: string;
    city: string;
  }[];
  courseListVos: {
    id: number;
    cover: string;
    name: string;
    price: number;
    typeName: string;
    typeLabelColor: string;
    type: number;
  }[];
} & AddressShape;

export enum ApiAppointmenStatus {
  Ended = 0,
  InProgress = 1,
  NotStarted = 2,
}

export interface ExhibitionShape extends detailsType, AddressShape {
  status: Boolean;
  id: number;
  name: string;
  price: number;
  carouselMap: ImageStringFormat[];
  startTime: DateShape;
  endTime: DateShape;
  cityName: string;
  cover: string;
  exhibitionInfo: {
    id: number;
    exhibitionId: number;
    details: TabSectionData;
  };
  isAppointment?: Boolean;
  isCollection?: Boolean;
  isDeleted?: number;
  completedOrderQuantity?: number;
  orderQuantityToBeWrittenOff?: number;
  totalSeatsLeftForAllScheduledExhibition?: number;
  appointmentStatus?: ApiAppointmenStatus;
  exhibitionStatus?: Boolean;
  sharePoster: string;
  // Only used for non-SH exhibitions, not seen unpopulated, but allowing null in case
  link: string | null;
  mainPictureVideo: VideoStringFormat | "";

  schedulingList?: ExhibitionSchedulingShape[];

  eventRecommendations?: EventRecommendationShape[];

  shopRecommendations?: PhysicalItemRecommendationShape[];
}
